<?
include("session.php");
$role_name = $_SESSION['role_name'];
$id = "";
if(isset($_GET['id'])) {
	$id = $_GET['id'];
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../webkit/utils/jquery.js"></script>
<script type="text/javascript" src="../webkit/utils/form.checker.js"></script>
<script type="text/javascript" src="../webkit/datepicker/WdatePicker.js"></script>
<link type="text/css" rel="stylesheet" href="page.css"/> 
<body  bgcolor="#f4f4f4" style="margin:0px;" scroll=no onload="init()">

<form name=f> 
<hr size=1>
<table width=100% cellspacing=1 cellpadding=3 id="basic_info_table"> 
	<tr>
        <td align=right nowrap>客户编号</td><td><input type='text' id="client_no" class='input' check='not_empty' warning='客户编号不能为空！'></td>  
		<td align=right>服务到期</td><td><input type="text" value="" id="exp_date" name="exp_date" class="datepicker" onClick="WdatePicker({readOnly:true, skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" size="10"></td>
	</tr>
	<tr>
		<td align=right>客户名称</td><td><input type='text' id="client_name" class='input' check='not_empty' warning='客户名称不能为空！'></td>
		<td align=right>联系手机</td><td><input type='text' id="mobilephone" class='input' check='not_empty' warning='联系手机不能为空！'></td>
	</tr>
	<tr>
		<td align=right>联系地址</td><td colspan=3><input type='text' id="address" class='input' check='not_empty' warning='联系地址不能为空！' style="width:500px"></td>
	</tr>
	<tr>
		<td align=right nowrap>客户类型</td><td><select id="client_type" class='input' check='integer' warning='请选择客户类型！'><option value=''>-请选择-</option><option value=1>单次</option><option value=2>包年</option><option value=3>VIP</option></select></td>
		<td align=right>联系电话1</td><td><input type="text" id="telephone1" class='input'></td>
		
	</tr>
	<tr>
		<td align=right nowrap>联系电话2</td><td><input type='text' id="telephone2" class='input'></td>
		<td align=right nowrap>联系电话3</td><td><input type='text' id="telephone3" class='input'></td>
	</tr>
	<input type='hidden' id="id">
</form>	

<table width=100% cellspacing=1 cellpadding=3>
	<tr>
		<td align=center>
		<hr size=1>
		<input type="button" id="btn_save" class="button" value="保存信息" onclick="save()">　　<input type="button" class="button" value="关闭窗口" onclick="parent.closeDlg()"></td>
	</tr>
</table>

<script type="text/javascript">
	var op = "<?echo $_GET['op']?>";
	var f = document.f;
	function save() { 
		if(FormChecker.doCheck(f)) {
			var params = {};
			var els = f.elements;
			for(var i=0; i<els.length; i++) {
				if(els[i].type == "button") continue;
				params[els[i].id] = els[i].value;
			}

			$.post("client_query.php?action="+op, params, function(data) {
				if(data.indexOf("ok") == 0) {
					alert("数据保存成功!");
					parent.refreshGrid();
					parent.closeDlg();
                } else {  
					alert(data);
				}
			});
		}
	}; 

	

	function init() {
	<?
	if($_GET['op'] == 'edit') {
	?>
	$.get("client_query.php?action=get&id=<?echo $_GET['id']?>", function(data){
		eval("var row = "+data);
		for(var k in row) {
			$('#'+k).val(row[k]);
		}
	});
	<?
	}
	?>
	}


</script>
</body>
</html>